

class LoginChecker():
    @staticmethod
    def checker_login_status_true(resp):
        status_code = resp.get("code")
        msg = resp.get("msg")
        assert status_code == 200 and msg == "登录成功" ,"登录响应码不等于200"

    @staticmethod
    def checker_login_token_true(resp):
        jwt_token = resp.get("jwt_token")
        assert len(jwt_token)>0, "没有下发token"

    @staticmethod
    def checker_login_user_info_true(resp):
        user_info = resp.get("user_info")
        uid = user_info.get("user_id")
        u_name = user_info.get("user_name")
        u_phone = user_info.get("phone")
        assert uid == 10 and u_name == "东大爷" and u_phone == "185****5943", "用户信息下发错误"

    @staticmethod
    def checker_login_status_false(resp):
        status_code = resp.get("code")
        msg = resp.get("msg")
        assert status_code != 200 and msg != "登录成功", "错误的用户名或密码也登录成功了"

    @staticmethod
    def checker_login_token_false(resp):
        jwt_token = resp.get("jwt_token")
        assert jwt_token == None, "登录失败也下发了token"

    @staticmethod
    def checker_login_user_info_false(resp):
        user_info = resp.get("user_info")
        assert user_info == None, "登录失败也下发了用户信息"